<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            display: flex;
            align-items: center;
        }
        input, select, button {
            margin-left: 10px;
        }
    </style>
</head>
<body>
    <div>
        <input type="text" id="p1">
        <select name="" id="type">
            <option disabled selected>请选择</option>
            <option value="+">+</option>
            <option value="-">-</option>
            <option value="*">*</option>
            <option value="/">/</option>
        </select>
        <input type="text" id="p2">
        <button>=</button>
        <input type="text" id="answer">
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <script>
        var $p1 = $('#p1');
        var $p2 = $('#p2');
        var $type = $('#type');
        var $btn = $('button');
        var $ans = $('#answer');

        $btn.on('click', function () {
            if ($p1.val().trim() != '' && $p2.val().trim != '' && $type.val()) {
                $ans.val(eval(`${parseFloat($p1.val())} ${$type.val()} ${parseFloat($p2.val())}`));
            }
        })
    </script>
</body>
</html>